<?php
//https://author.baidu.com/home/1605662285475872
if($_GET['gather_type']==6&&preg_match("/author\.baidu\.com/Uisx",$this->url,$nn)){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $this->url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language:  en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"));
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, "false");
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, "2");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0);
    curl_setopt($ch, CURLOPT_VERBOSE,1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host:  author.baidu.com","Connection:  keep-alive","Accept:  text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3","Accept-Language:  en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"));
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $result=curl_exec($ch);
    curl_close($ch);
    $c=$GLOBALS['mycurl']->result($result,$this->url);
    $uk=re("/\"\,\"uk\"\:\"(.*)\"\,\"/Uisx",$result)[1];
    $Mhor=re("/Hmery\-Time\=([0-9]+)\;/Uisx",$result)[1];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://mbd.baidu.com/webpage?tab=article&uk={$uk}&type=newhome&action=dynamic&format=jsonp&Tenger-Mhor={$Mhor}&callback=__jsonp01571813261463");
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36");
    curl_setopt($ch, CURLOPT_REFERER, $this->url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language:  en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"));
    curl_setopt($ch, CURLOPT_COOKIE,$c->cookie);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, "false");
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, "2");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0);
    curl_setopt($ch, CURLOPT_VERBOSE,1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host:  mbd.baidu.com","Connection:  keep-alive","Accept:  */*","Accept-Language:  en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"));
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $result=curl_exec($ch);
    curl_close($ch);
    preg_match("/__jsonp[0-9]+\((.*)\)\s*$/Uisx",$result,$nn);
    $json=$nn[1];
    $json=preg_replace("/\"timestamp\":\"[0-9\.]+\"/","\"timestamp\":\"\"",$json);
    $json=preg_replace("/\"load\":\"[0-9\.]+\"/","\"load\":\"\"",$json);
    $pagehtml=$json;
    $c->result($pagehtml,$this->url);

    $datam=json_decode($json,1);
    $result=array();
    for($i=0;$i<count($datam['data']['list']);$i++){
        $data=array();
        $data['url']=$datam['data']['list'][$i]['itemData']['url'];
        $data['title']=$datam['data']['list'][$i]['itemData']['title'];
        $result[]=$data;
    }
    $GLOBALS['listdata']=$result;
}

if(preg_match("/link\?url=/",$this->url,$nn)){
    $this->changeurlre("<META[^<>]*http\-equiv=\"refresh\"\s[^<>]*URL=['\"]([^<>\"\']*?)[^<>]*>",function($url){
        return $url;
    });
}